package com.mo.lib.view.gridview

import android.content.Context
import android.util.AttributeSet
import android.widget.GridView

/**
 * @ author：mo
 * @ data：:
 * @ 功能：自定义gridview解决listview嵌套gridview时，gridview里只显示一行的bug，
 */
class KGridView@JvmOverloads constructor(context: Context, attrs: AttributeSet?=null, defStyle: Int=0) : GridView(context,attrs,defStyle) {

    public override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
        val expandSpec = MeasureSpec.makeMeasureSpec(Int.MAX_VALUE shr 2, MeasureSpec.AT_MOST)
        super.onMeasure(widthMeasureSpec, expandSpec + 50)
    }
}